#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<string.h>
void reverse(char* left, char* right)
{
    while (left < right)
    {
        char tmp = *left;
        *left = *right;
        *right = tmp;
        left++;
        right--;
    }
}
int main()
{
    char str[10000] = { 0 };
    gets(str);
    reverse(str, str + strlen(str) - 1);
    char* p = str;
    while (*p)
    {
        char* start = p;
        while (((*p <= 'z' && *p >= 'a') || (*p <= 'Z' && *p >= 'A')) && *p)
        {
            p++;
        }
        if (*p)
        {
            *p = ' ';
        }
        if (p - 1 - start)
        {
            reverse(start, p - 1);
        }
        p++;
    }
    printf("%s", str);
    return 0;
}